<template>
    <div class="header_container">

		<el-breadcrumb separator="/">
			<el-breadcrumb-item :to="{ path: '/menu' }">首页</el-breadcrumb-item>
			<el-breadcrumb-item v-for="(item, index) in $route.meta" :key="index">{{item}}</el-breadcrumb-item>
		</el-breadcrumb>
		<el-dropdown @command="handleCommand" menu-align='start' style="color: black;">
			
			<span>{{this.$store.state.adminInfo.name}}</span> 
			<img src="@/assets/Lp_logo2.png" class="avator">
			<el-dropdown-menu slot="dropdown">
				<el-dropdown-item command="signin">登入</el-dropdown-item>
				<!-- <el-dropdown-item command="signout">退出</el-dropdown-item> -->
			</el-dropdown-menu>
		</el-dropdown>
    </div>
</template>

<script>

    export default {
    	data(){
    		return {
    		}
    	},
    	created(){
    	},
    	computed: {
    	},
		methods: {
			async handleCommand(command) {
				if (command == 'signin') {
					
						this.$prompt('请输入密码', '提示', {
							confirmButtonText: '确定',
							cancelButtonText: '取消',inputType: 'password',
							inputType: 'password',
						}).then(({
							value
						}) => {
							if (value == '666888') {
								this.$message({
									type: 'success',
									message: '密码正确，登入成功:'
								});
								let adminInfo={
									lp_addr: '',
									name: 'admin',
									tuoguan_permission: 'yes',
									web3_permission: 'yes',
								}
								this.$store.commit('saveAdminInfo',adminInfo)
								
								
							} else {
								this.$message({
									type: 'error',
									message: '密码出错'
								});
							}
						}).catch(() => {
							this.$message({
								type: 'info',
								message: '取消输入'
							});
						});
					
					
				}else if(command == 'signout'){
				
	                this.$router.push('/');
					
				}
			},
		}
    }
</script>

<style >
	.header_container{
		background-color: 	#E0F8FF;
		/* background-color: 	PeachPuff; */
		
		height: 60px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-left: 20px;
	}
	.avator{
		width: 35px;
		height: 35px;
		border-radius: 50%;
		margin-right: 37px;
	}
	.el-dropdown-menu__item{
        text-align: center;
    }
</style>
